package com.lizy.function

/**
 * 校验时间戳的
 * 当前时间在时间戳方圆一小时内有效
 */
class CheckTimestamp {
    def process(){
        if (timestamp == null || timestamp <= 0 ) {
            return false
        }
        def time = new Date().getTime();
        def timeUnix = (time / 1000).toInteger();
        if ((timestamp + 3600) < timeUnix || (timestamp - 3600) > timeUnix) {
            return false;
        }
        return true;
    }

    static void main(String[] args) {
        //println(new Date().getTime());
        println(new CheckTimestamp().process())
    }
    def timestamp = 1708322312
}
